<template>
  <div class="cart">
    <h2>你的购物车</h2>
    <p>
      <i>请添加一些商品到购物车</i>
    </p>
    <ul>
      <li v-for="(item, i) in CartStore.cartProducts" :key="i">
        {{ item.title }} - {{ item.price }} * {{ item.quantity }}
      </li>
    </ul>
    <p>商品总价:{{ CartStore.totalPrice }}</p>
    <p>
      <button @click="CartStore.checkout">结算</button>
    </p>
    <p v-show="CartStore.checkoutStatus">结算{{ CartStore.checkoutStatus }}</p>
  </div>
</template>

<script lang="ts" setup>
import {} from "vue";
import { useCartStore } from "../store/cart";
const CartStore = useCartStore();
</script>

<style lang="less" scoped></style>
